package com.intelligentmeterreadingsys.usermanager.activity;

import com.intelligentmeterreadingsys.R;
import com.intelligentmeterreadingsys.waterlist.db.WaterListDaoImpl;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.AdapterView.OnItemSelectedListener;

public class UserInfoConditionActivity extends Activity{

public Button button1;
	
	public EditText edit1;//用户名称
	
	public EditText edit2;//用户编号
	
	public EditText edit3;//用户电话
	
	public EditText edit4;//用户地址
	
    public Spinner spinner;//用户类型
		
	private String[] usertypes;
	
	public String usertype;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.setquerycondition);
		init();
		
	}
     
	public void init(){
		edit1=(EditText)findViewById(R.id.edit_username);
		edit2=(EditText)findViewById(R.id.edit_usernumber);
		edit3=(EditText)findViewById(R.id.edit_userphone);
		edit4=(EditText)findViewById(R.id.edit_useradds);
		spinner=(Spinner)findViewById(R.id.spinner_usertype);
		WaterListDaoImpl dao=new WaterListDaoImpl(this);
		usertypes=dao.queryUserType();
		dao.close();
		 ArrayAdapter<String> ada=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,usertypes);
		 ada.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		 spinner.setAdapter(ada);
		 button1=(Button)findViewById(R.id.set_query_button);
		 
		 button1.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				
			}
		});
		 spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> arg0, View arg1,
					int arg2, long arg3) {
				usertype=arg0.getItemAtPosition(arg2).toString();
				
			}

			@Override
			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub
				
			}
			 
		});
		 
		
	}
}
